/*
 * @Author: 生俊甫 1758142861@qq.com
 * @Date: 2025-01-25 16:59:15
 * @LastEditors: 生俊甫 1758142861@qq.com
 * @LastEditTime: 2025-01-25 17:19:13
 * @FilePath: /sjf/weChat_project/test_to_there/framework/etcd_test/e_s.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "etcd.hpp"

DEFINE_bool(run_mode,false,"运行模式(true表示发布模式,false表示调试模式)");
DEFINE_string(log_file,"","发布模式下,指定的日志输出文件名");
DEFINE_int32(log_level,0,"发布模式下,指定的日志输出等级");

DEFINE_string(etcd_host,"http://127.0.0.1:2379","服务器注册中心地址");
DEFINE_string(base_service,"/service","服务监控根目录");
DEFINE_string(instance_name,"/friend/instance","当前实例名称");

void online(const std::string& service_name,const std::string& service_host)
{
    LOG_DEBUG("上线服务:{}-{}",service_name,service_host);
}
void offline(const std::string& service_name,const std::string& service_host)
{
    LOG_DEBUG("下线服务:{}-{}",service_name,service_host);
}

int main(int argc,char* argv[])
{
    google::ParseCommandLineFlags(&argc,&argv,true);
    init_logger(FLAGS_run_mode,FLAGS_log_file,FLAGS_log_level);
    
    discovery::ptr dclient = std::make_shared<discovery>(FLAGS_etcd_host,
    FLAGS_base_service,online,offline);

    std::this_thread::sleep_for(std::chrono::seconds(1000));
    return 0;
}